//
//  RecordingBtnViewController.m
//  CollTest
//
//  Created by codew on 1/12/22.
//

#import "RecordingBtnViewController.h"
#import "CPSCameraBottomView.h"
#import "CPSFullScreenCameraPlayView.h"

@interface RecordingBtnViewController ()
@property (weak, nonatomic) IBOutlet UIView *viewBottomSuper;

@property (weak, nonatomic) IBOutlet UIView *viewCR;
@property (nonatomic, strong) CPSCameraBottomView * viewBottom;

@property (strong, nonatomic) CPSFullScreenCameraPlayView *playView;
@end

@implementation RecordingBtnViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    
    [self.viewBottomSuper addSubview:self.viewBottom];
    [self.viewBottom mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.bottom.mas_equalTo(0);
    }];

    
//    self.viewCR.backgroundColor = CPSCRGBA(255, 255, 255, 0.5);
    
    [self.viewCR addSubview:self.playView];
    
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction)];
    [self.viewCR addGestureRecognizer:tap];
    
//    self.viewCR.layer.cornerRadius = 40;
//    self.viewCR.layer.borderWidth = 20;
//    self.viewCR.layer.borderColor = [UIColor whiteColor].CGColor;
//    self.viewCR.layer.masksToBounds = YES;
    
    
//    
//    //创建一个View
//        UIView *maskView = [[UIView alloc] initWithFrame:CGRectMake(66, 66, 300, 300) ];
//        maskView.backgroundColor = [UIColor whiteColor];
//        maskView.alpha = 0.8;
//        [self.view addSubview:maskView];
//        
//        //贝塞尔曲线 画一个带有圆角的矩形
//        UIBezierPath *bpath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(10, 10, 66, 66) cornerRadius:15];
//        //贝塞尔曲线 画一个圆形
//        [bpath appendPath:[UIBezierPath bezierPathWithArcCenter:maskView.center radius:100 startAngle:0 endAngle:2*M_PI clockwise:NO]];
//        
//        //创建一个CAShapeLayer 图层
//        CAShapeLayer *shapeLayer = [CAShapeLayer layer];
//        shapeLayer.path = bpath.CGPath;
//        
//        //添加图层蒙板
//        maskView.layer.mask = shapeLayer;
    
}


- (void)tapAction
{
    [self.playView startAnimation];
}


- (CPSCameraBottomView *)viewBottom
{
    if (!_viewBottom) {
        
        _viewBottom = [CPSCameraBottomView cameraBottomView];
    }
    
    return _viewBottom;
}

- (CPSFullScreenCameraPlayView *)playView {
    if (!_playView) {
        _playView = [[CPSFullScreenCameraPlayView alloc] initWithFrame:CGRectMake(0, 0, 70, 70)
                                                                 color:[UIColor redColor]];
        _playView.duration = 20;//self.manager.configuration.videoMaximumDuration;
//        _playView.progress = 40;
    }
    return _playView;
}
@end
